package com.tanhua.controller;


import com.tanhua.service.AnalysisByDayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;

@RestController
@RequestMapping("/dashboard")
public class DashboardController {

    @Autowired
    private AnalysisByDayService service;

    /**
     * 首页，统计的摘要数据
     * get  /summary
     */
    @GetMapping("/summary")
    public ResponseEntity summary() {
        return service.summary();
    }

    /**
     * 首页，新增、活跃用户、次日留存率的曲线图
     * get  /users
     */
    @GetMapping("/users")
    public ResponseEntity users(Long sd,Long ed ,String type) throws ParseException {
        return service.users(sd,ed,type);
    }
}